package com.jie.springwebapp.controller;

import com.jie.springwebapp.pojo.Address;
import com.jie.springwebapp.pojo.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

//@Controller
public class ResponseController {
//    @ResponseBody
//    @RequestMapping("/hello")
//    public String hello() {
//        System.out.println("hello");
//        return "OK";
//    }
//    @ResponseBody
//    @RequestMapping("/getAddr")
//    public Address getAddr() {
//        Address address = new Address();
//        address.setCity("武汉");
//        address.setProcince("湖北");
//        return address;
//    }
//    @ResponseBody
//    @RequestMapping("/listAddr")
//    public List<Address> listAddr(){
//        List<Address> list = new ArrayList<>();
//        String[] city = new String[]{"北京","上海","重庆","武汉"};
//        String[] pro = new String[]{"北京","上海","重庆","湖北"};
//        for (int i = 0; i < city.length; i++) {
//            list.add(new Address(pro[i],city[i]));
//        }
//        return list;
//    }
//    @ResponseBody
//    @RequestMapping("/hello")
//    public Result hello() {
//        System.out.println("Hello world~");
//        return Result.success("Hello world~");
//    }
//    @ResponseBody
//    @RequestMapping("/getAddr")
//    public Result getAddr() {
//        Address address = new Address();
//        address.setCity("武汉");
//        address.setProcince("湖北");
//        return Result.success(address);
//    }
//    @ResponseBody
//    @RequestMapping("/listAddr")
//    public Result listAddr(){
//        List<Address> list = new ArrayList<>();
//        String[] city = new String[]{"北京","上海","重庆","武汉"};
//        String[] pro = new String[]{"北京","上海","重庆","湖北"};
//        for (int i = 0; i < city.length; i++) {
//            list.add(new Address(pro[i],city[i]));
//        }
//        return Result.success(list);
//    }
}
